package cn.ssm.biz.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import cn.ssm.biz.StudentBiz;
import cn.ssm.dao.StudentMapper;
import cn.ssm.pojo.Pager;
import cn.ssm.pojo.Student;
import cn.ssm.query.StudentQuery;
@Service("studentBiz")
public class StudentBizimpl implements StudentBiz{

	public StudentMapper getStudentMapper() {
		return studentMapper;
	}
	public void setStudentMapper(StudentMapper studentMapper) {
		this.studentMapper = studentMapper;
	}
	@Autowired
	@Qualifier("studentMapper")
	private StudentMapper studentMapper;
	@Override
	public int addStudent(Student s) {
		// TODO Auto-generated method stub
		return studentMapper.insertStudent(s);
	}
	public StudentMapper getStudentMpper(){
		return studentMapper;
		
	}
	public void setStudentMpper(StudentMapper studentMapper){
		this.studentMapper=studentMapper;
		
	}
	@Override
	public List<Student> findStudent(Pager pager) {
		int form =(pager.getCurrentPage()-1)*(pager.getRowPerPage());
		return studentMapper.selectStudentlist2(form, pager.getRowPerPage());
	}
	@Override
	public int delStudent(int id) {
		return studentMapper.deleteStudent(id);
	}
	@Override
	public int UpdateStudent(Student s) {
		return studentMapper.UpdateStudent(s);
	}
	@Override
	public Student findStuById(int id) {
		// TODO Auto-generated method stub
		return studentMapper.selectStuById(id);
	}
	@Override
	public int findStuCount() {
		// TODO Auto-generated method stub
		return studentMapper.selectStuCount();
	}
	@Override
	public List<StudentQuery> findStudent1(Pager pager) {
		// TODO Auto-generated method stub
		int form =(pager.getCurrentPage()-1)*(pager.getRowPerPage());
		return studentMapper.selectStudentlist(form, pager.getRowPerPage());
	}
	@Override
	public List<StudentQuery> selectStudentlistByClassId(int classId,Pager pager) {
		int form =(pager.getCurrentPage()-1)*(pager.getRowPerPage());
		return studentMapper.selectStudentlistByClassId(classId,form, pager.getRowPerPage());
	}
	@Override
	public int findStuCountByClassId(int classId) {
		// TODO Auto-generated method stub
		return studentMapper.selectStuCountByClassId(classId);
	}
	
	
	@Override
	public List<Student> getStuByUserName(String userName) {
		// TODO Auto-generated method stub
		return studentMapper.selStuByUserName(userName);
	}

	
	
	
}
